<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use Faker\Generator as Faker;
use \App\Models\MoneyOut;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/


$factory->define(MoneyOut::class, function (Faker $faker) {
    $sentence = $faker->sentence();

    // 随机取 5 年前到现在的时间
    $updated_at = $faker->dateTimeBetween('-5 years');
    // 传参为生成最大时间不超过，创建时间永远比更改时间要早
    $created_at = $faker->dateTimeBetween('-5 years',$updated_at);
    $call_at = $faker->dateTimeBetween($created_at, 'now');
    $outmoney = $faker->numberBetween(1,500)* 10000;
    $fee = $outmoney * 0.01;
    $pay_count = $faker->randomElement([3,6,12,18,24,36,48,60,120]);
    $pay_monthly = $outmoney / $pay_count;
    return [
        'check_status' =>  $faker->numberBetween(1,2),
        'out_money' => $outmoney,
        'fee' => $fee,
        'pay_type' => $faker->numberBetween(1,2),
        'dianzihuidan'=>$faker->realText(20),
        'pay_count' => $pay_count,
        'pay_monthly' => $pay_monthly,
        'out_at' => $call_at,
        'created_at' => $created_at,
        'updated_at' => $updated_at,
    ];
});
